Component({
  data: {
    isRefresh: false,
    startY: 0,
    touching: false,
    labelSelectId: 1, // 菜单选项被选中ID,
    panelContent: "全部", // 面板展示内容
    optionList: [
      { id: 1, name: '全部' },
      { id: 2, name: '待付款' },
      { id: 3, name: '已付款' },
      { id: 4, name: '购物车' }
    ]
  },
  methods: {
    tabsLabelHandle(e) {
      let { id, name } = e.currentTarget.dataset.item;
      this.setData({
        labelSelectId: id,
        panelContent: name
      });
    },

    touchStartHandle(e) {
      this.data.startY = e.touches[0].clientY;
      this.data.touching = true;
    },
    touchMoveHandle(e) {
      if (this.data.touching) {
        const moveY = e.touches[0].clientY;
        const diff = moveY - this.data.startY;
        if (diff > 50 && !this.data.isRefresh) { // 手势判断
          this.setData({
            isRefresh: true
          });
          // todo what you want
          // 模拟加载数据
          setTimeout(() => {
            this.setData({
              isRefresh: false
            });
          }, 2000);
        }
      }
    },
    touchEndHandle(e) {
      this.data.touching = false;
    }
  }
});